package com.xiaoshuidi.cloud.module.member.api.invite;

import com.xiaoshuidi.cloud.framework.common.pojo.CommonResult;
import com.xiaoshuidi.cloud.module.member.controller.app.invite.vo.AddInviteLogVo;
import com.xiaoshuidi.cloud.module.member.service.invite.InviteActivityLogService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController // 提供 RESTful API 接口，给 Feign 调用
@Validated
public class InviteApiImpl implements InviteApi{
    @Resource
    InviteActivityLogService inviteActivityLogService;

    @Override
    public CommonResult<Boolean> addInviteLog(Long tenantUserId, Long inviteAccountId, String invitePhone, Integer inviteConfigId) {
        try{
            AddInviteLogVo vo = new AddInviteLogVo();
            vo.setAccountId(tenantUserId);
            vo.setInviteAccountId(inviteAccountId);
            vo.setInvitePhone(invitePhone);
//            vo.setInviteConfigId(inviteConfigId);
            inviteActivityLogService.addUserInviteLog(vo);
            return CommonResult.success(Boolean.TRUE);
        }catch (Exception e){
            return CommonResult.success(Boolean.FALSE);
        }

    }
}
